Skip to content

feat(artifacts): infinite canvas, arrangement and annotations - #5346

Merged
shepherdjerred merged 5 commits into
mainfrom
artifacts-infinite-canvas
Nov 28, 2026
Merged

shepherdjerred merged 5 commits into
mainfrom
artifacts-infinite-canvas

Conversation

@shepherdjerred

Copy link
Copy Markdown
Owner

Supersedes #5260, #5273 and #5286. Stacked on the artifacts review service PR (#5331), not on activation (#5342): the canvas is client-side UI and board-index contract work that does not need the service deployed.

Why

M2 and M3 of the review UI: the board opens as a free infinite canvas an agent publish can land on, Jerred arranges frames and comments in a floating shell, and annotates the board (text, sticky, pen, box, arrow, line) with the notes persisted in the board index so agents read them back (toolkit artifacts show --json already prints index.notes, and it parses through the contract, which now knows pen).

What

One commit per superseded PR, on #5331:

  1. Infinite canvas (feat(artifacts): infinite canvas — camera, gestures, frames #5260): hand-rolled DOM canvas (camera written once per rAF, wheel/pinch/gesture input, three frame tiers with one live frame and at most 8 inert previews, board and frame pins on an unscaled overlay, the grid removed). Client only.
  2. Arrange (feat(artifacts): arrange frames on the canvas #5273): select, drag, eight resize handles, grid snap, z-order, nudge, delete behind a confirm, undo and redo over a replicated outbox of boards.applyOps ops; the contract change moveFrames takes optional w and h; the MessageCircle comment cursor and pins; the floating tool pill; the floating, collapsible comments panel; the floating nav pill.
  3. Annotations (feat(artifacts): board annotations #5286): the pen note (origin plus up to 500 offset points; notes.ts and board-primitives.ts split out of contract.ts), the T, S, P, B, A, L tools, notes rendered in the world layer with geometry hit-testing, text editing, palette, undo over notes, and the outline listing sticky and title text.

Changes beyond a straight replay of the three PRs (the canvas branches were built on the pre-final UI, and the gates on main are stricter than they were):

  • @base-ui/react is a dependency of @shepherdjerred/artifacts again (bun.lock regenerated): the floating nav menu imports it, and the UI PR's knip fix had removed it while nothing used it.
  • BoardData is exported from client/data/api.ts again (the canvas imports it; the same knip fix had removed it).
  • knip now analyses .tsx for this package (the UI PR's knip.json change), which surfaced dead exports in the canvas code that the old config could not see: Note (shared/notes.ts), NoteKind, clampSize and entryForward are removed.
  • jscpd (baseline untouched): useFollowRect in canvas/follow.ts replaces three copies of the "size and place over a world rectangle" callback, useHandleDrag in arrange/handles.tsx replaces two copies of the pointer handlers, arrange/fixtures.ts holds the frame ids and board the arrange tests copied, and canvas-helpers.ts gains FIXED_CAMERA, openBoardAtFixedCamera and expectNoAxeViolations for the four e2e specs that copied them.
  • quality-ratchet (baseline untouched): shell.spec.ts used test.skip(isMobile, ...) nine times, which the ratchet counts as unconditional skips. Those tests are tagged @desktop or @phone and the Playwright projects use grepInvert, so each runs exactly where it applies and none is skipped (206 e2e tests pass, none reported skipped).
  • The intermediate commits are not individually verified; the checks below are for the head.

Demo

Infinite canvas (#5260)

Before (grid) and after (canvas), same board:

Before After
before after

Zoomed in on a selected frame with its pin, and the live frame (WebKit) with the Exit chip:

selected
live

Settled sharpness at 200 % (WebKit) and fit-all at 50 % on the seeded demo board (Chromium):

zoom 200
zoom 50

Recording of pan, zoom at the cursor, fit, select, activate and exit: canvas-tour.webm

Arrange, shell and comment cursor (#5273)

Floating shell: canvas with the panel open, collapsed (full width again, the pill shows the count), the focused view, and a phone (pill above the tools, then the bottom sheet). For the before, compare the earlier shots below (full-width bars and a sidebar column):

canvas, panel open
canvas, panel collapsed
focused view
phone, collapsed
phone, bottom sheet

MessageCircle cursor (rendered at 4x) beside the pins and the toolbar icon it comes from:

cursor and pins

Toolbar (select, comment and hand active):

select
comment
hand

Speech-bubble cursor (Playwright cannot capture the OS cursor, so it is rendered at 4x) next to placed pins, then a recording of placing a pin in comment mode:

cursor and pins

comment-place.webm

Re-captured: fit-all with filled and dashed (approximate) pins, and the selected frame with one ring, plus keyboard focus on a chip:

pins
selected
chip focus

Marquee select, the selected frame with its eight handles, and an agent publish arriving mid-drag (the dragged frame stays under the pointer, a toast names the new frame, the camera does not move):

marquee
handles
mid-drag publish
after release

Recording of arranging a board, an agent publish arriving mid-drag, resize, undo, redo and z-order: arrange-tour.webm

Annotations (#5286)

A board with two concepts annotated: a title, a sticky with a colour, a box, an arrow, a pen stroke; the palette with the sticky selected; and an agent's putNote arriving live:

board
annotated
palette
agent note

Recording: annotations-tour2.webm (draws each kind, edits text, moves, undoes and redoes, then an agent note appears).

Verification

Local evidence on the exact head; CI, publication, deployment and runtime are not claimed.

  • bun install --frozen-lockfile and bunx turbo run generate leave no diff.
  • bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts: green, 440 unit tests. The first pass of the same command with the toolkit, root-scripts and ops-model also built, type-checked and linted clean; git-spice/branch-create.test.ts timed out under the parallel run and passes alone (5/5), as on main.
  • bunx turbo run test:extended --filter=@shepherdjerred/artifacts --filter=@shepherdjerred/toolkit: 71 PostgreSQL tests (every note kind round-trips through boards.get; a 501-point stroke is a 400) and the toolkit artifacts-contract test pass.
  • bun run test:e2e in packages/artifacts: 206 passed on desktop Chromium, mobile Chromium and WebKit (canvas, arrange, comment, notes and shell specs, axe), none skipped.
  • bun scripts/tools/knip.ts clean; bun run jscpd baseline ratchet passed; bun run quality-ratchet passed; bun run check-service-registration complete; root Turbo set (//#knip //#compliance-check //#check-test-standardization //#check-directory-file-counts //#check-floating-deps //#lockfile-check //#markdownlint //#hadolint //#quality-ratchet) 22/22.
  • bunx lefthook run pre-commit over the full diff against feat(artifacts): the artifacts review service — server, UI and CLI (prepared, inactive) #5331's branch passes.
  • docker build --target smoke -f packages/artifacts/Dockerfile . from a clean export of the branch: exit 0.
  • Not run: Woodpecker CI, real trackpad, iPad and Safari gestures (synthetic events only), Firefox, the OS cursor (Playwright cannot capture it), and any live behaviour.

🤖 Generated with Claude Code

https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT

@shepherdjerred

shepherdjerred commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner Author

@greptile-apps

greptile-apps Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

shepherdjerred and others added 5 commits November 28, 2026 00:38
Why
M2 needs the board to open as a free canvas an agent publish can land on.
The grid was a placeholder body in `BoardPage` for exactly this.

What
- Hand-rolled DOM canvas modelled on Claude's design canvas. The world layer
  is `translate(x, y) scale(s)` (origin 0 0, s 0.05 to 4); chips, the
  selection ring, the Exit chip, pins and the toolbar are an unscaled overlay
  that follows the camera. The camera is a plain object written once per rAF;
  React hears about it on settle (120 ms pan, 250 ms zoom). `will-change` is
  set only while the camera moves.
- Input: non-passive wheel (Ctrl/Meta zooms at the cursor), Safari gesture
  events and a two-pointer pinch arbitrated so one pinch applies once,
  Space-, middle- and H-drag pan, a pan blanket during drags, and wheel and
  gesture input a live frame forwards over the bridge. `1` fit all, `2` fit
  selection, `0` 100 %; the camera is stored per board.
- Frames come from the index at world pixels. Three tiers: one live frame
  (double-click or Enter, Exit chip and Esc), at most 8 inert previews (4 in
  Firefox, lowered by 2 when the rAF p95 over the last 2 s of motion is over
  25 ms, floor 3, with eviction hysteresis) and the typed placeholder.
  Stacking is CSS z-index from `order`; iframes are never moved or remounted.
- Board pins (`board{page,x,y}`) and frame pins (via the existing
  `AnchorAdapter`s) sit on the overlay. The sidebar lists all board threads.
- The outline stays the keyboard path; its link is the first tab stop and the
  frame chips follow in reading order.
- The grid is removed; `?view=canvas` skips a launch redirect.

Verification
- bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts
- bun run test:e2e in packages/artifacts: desktop Chromium, mobile Chromium
  and WebKit, including the canvas spec (zoom-at-cursor within 1 px, zero
  iframe document requests on select, live toggle and a new frame, pins, axe,
  reduced motion).
- Not run: real trackpad, iPad and Safari gestures (synthetic events only);
  Firefox (cap lowered by user agent, not exercised).

Supersedes #5260.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
Why
M2 done-when: layout survives a reload, and an agent publish during a drag
loses neither change.

What
- Select (click, Shift-click, marquee on empty canvas), drag with a 4 px
  threshold, pointer capture and edge auto-pan, eight resize handles (a
  fixed-viewport frame keeps its aspect, a responsive one resizes freely),
  8 px grid snap (Alt disables), `[` `]` z-order, arrow nudge (Shift 10x),
  Delete from board behind a confirm (never the artifact), undo and redo
  (Mod+Z, Shift+Mod+Z) over the applied ops. Esc cancels a drag.
- The arrangement is a replicated document: the server's index plus an outbox
  of `boards.applyOps` ops, drawn as the index with the outbox applied on
  top. Saves are debounced 400 ms and flushed on `pagehide` (a keepalive
  request). A change from another actor merges by id, never moves the camera
  and never disturbs a drag in progress (the draft is drawn over the
  document). A toast names a new frame, with a jump-to.
- Undo entries record before and after for the touched frames and replay as
  ops against the board as it is now, so another actor's frames are left alone.
- `aria-live` announcements for moves, resizes, order and removal.
- Dialog: a native `close` event from our own `close()` no longer closes a
  dialog reopened in between.

Verification
- bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts
- bunx turbo run test:extended --filter=@shepherdjerred/artifacts
- bun run test:e2e: desktop Chromium, mobile Chromium and WebKit, including
  the arrange spec (drag, snap, Alt, reload persistence, aspect and free
  resize, agent publish mid-drag, undo and redo, nudge, z-order, delete and
  undo, pagehide flush, edge auto-pan, Esc cancel, axe).
- Not run: real trackpad and iPad gestures.

Folded in (from the same PR), each with its own Why/What/Verification in the
original history:
- feat(artifacts): resize a frame through moveFrames: `moveFrames` entries take
  optional `w` and `h` (omitted leaves the size alone); the domain merge and the
  e2e fake apply them, so a resize merges under the row lock like a drag.
- feat(artifacts): speech-bubble comment cursor and pins
- feat(artifacts): restyle the canvas toolbar as a floating pill (V, H, C tool
  pill; zoom in its own pill; `useToolModes`)
- feat(artifacts): MessageCircle cursor and pins, floating comments panel and
  nav pill (Shift+C panel, full-bleed canvas and focused view, floating nav pill)

Supersedes #5273.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
Why
M3: Jerred arranges and annotates; agents change content. Annotations persist
in the board index and agents read them back.

What
- Tool pill group 2: text (T), sticky (S), pen (P), box (B), arrow (A), line
  (L). A drag draws (a click makes a title or a default sticky), the tool
  reverts to select after one shape unless Shift is held, Shift snaps lines
  to 45 degrees.
- Notes render in the world layer (so they stay sharp; `will-change` only
  while the camera moves): a div for sticky, title and box, one `<svg>` per
  straight segment and one path per pen stroke. They never take a pointer;
  `shapes.ts` hit-tests geometry (a 12 screen-pixel stroke for lines, arrows
  and strokes, borders only for boxes) and the topmost of a note and a frame
  by `order` wins.
- Text is edited in an overlay `<textarea>` placed through the camera (Enter
  or double-click; Ctrl/Cmd+Enter saves, Esc abandons; an empty new note is
  dropped). A palette sets colours and a title's size.
- Pen strokes are simplified (Ramer-Douglas-Peucker, tolerance grown until the
  stroke fits the 500-point cap).
- Select, move, resize (box and sticky handles, line and arrow endpoint
  handles), z-order, delete and undo use the arrangement machinery: history
  entries now cover notes and replay as `putNote` and `deleteNote`; adjacent
  puts of one note coalesce.
- The outline lists the text of stickies and titles.
- Canvas split: the overlay is `CanvasOverlay`, tool modes `useToolModes`.
- The zoom pill moves above the tools in a narrow canvas (container query).

Verification
- bunx turbo run build typecheck test lint test:extended --filter=@shepherdjerred/artifacts
- bun run test:e2e: desktop Chromium, mobile Chromium and WebKit (177 tests),
  including the notes spec: every kind drawn, tool reverts, Shift lock,
  typed text and dropped empties, edit and undo, hit testing (6 px hit, 12 px
  miss, box middle ignored), move, resize and endpoint drag, delete and undo
  and redo, colour, z-order, reload persistence, an agent's putNote arriving
  live, sharpness (will-change auto at rest) and axe.

Folded in (from the same PR):
- feat(artifacts): a pen note on the board index: `NoteSchema` gains `pen`
  (origin, offset points, 2 to 500 points via `MAX_PEN_POINTS`, colour); the
  note schema and board primitives move into `notes.ts` and
  `board-primitives.ts` to keep `contract.ts` under the file-size limit.

Supersedes #5286.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
Why
- The canvas adds a ThemeToggle use that console-ui deprecated and pushes
  FrameViewer over the cognitive-complexity limit.

What
- floating-nav uses ThemeButton, like the app header.
- FrameViewer reads which controls to draw from one small function.

Verification
- bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts: pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
Why
- The console-ui conformance scan (#5438) now covers artifacts; the canvas
  styles added 1 inline-typography, 9 colour-literal and 1 shared-class-patch
  finding, and the allowlist may only shrink.

What
- Shadows use var(--ui-shadow-menu) instead of colour-mix on black.
- A title note passes its size as a --ar-title-font custom property.
- The narrow floating nav no longer restyles .ui-workspace-label, which
  already ellipsizes.

Verification
- vitest run src/client/conformance.test.ts: pass with no allowlist change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
@shepherdjerred
shepherdjerred force-pushed the artifacts-infinite-canvas branch from 58b6518 to c3c48e9 Compare November 28, 2026 17:30
@shepherdjerred
shepherdjerred marked this pull request as ready for review November 28, 2026 17:58
@shepherdjerred
shepherdjerred merged commit 35f953a into main Nov 28, 2026
3 checks passed
@shepherdjerred
shepherdjerred deleted the artifacts-infinite-canvas branch November 28, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant